package com;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.shared.util.ArrayUtils;

public class Test {

	
	public static void main(String[] args)throws Exception {
		
		/*
		String zipFilePath = "/tmp/xx.zip" ;
		FileOutputStream fos=new java.io.FileOutputStream(zipFilePath); 
		ArchiveOutputStream zaos = new org.apache.commons.compress.archivers.ArchiveStreamFactory().createArchiveOutputStream("zip",fos);
				
		File file = new File("/tmp/xxx.txt");      
		ZipArchiveEntry zipArchiveEntry = new org.apache.commons.compress.archivers.zip.ZipArchiveEntry( file.getName() );    
		//添加成员到压缩包对象中    
		zaos.putArchiveEntry(zipArchiveEntry);     
		//获取当前文件的输入流    
		//将输入流内容读取到压缩包输出流中    
		IOUtils.copy( new java.io.FileInputStream(file) , zaos);     
		//清除entry对象准备添加下一个文件   
		zaos.closeArchiveEntry();     
		zaos.finish();
		*/
		
//		ExportToCustomExcelView ecev = new ExportToCustomExcelView();
//		
//		Class clazz = ecev.getClass();
//		
//		Method method = clazz.getDeclaredMethod( "populatePropertyModel", SimMgrDbObjectList.class , SimMgrConnection.class );
//		method.setAccessible(true);
//		PropertyModel pm  = (PropertyModel) method.invoke(ecev, null , null );
//		//PropertyModel pm = ecev.get
		
		Date nowDate = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
		String strDate = sdf.format( nowDate );
		
		String str =   "dahai.meng_" + strDate ;
		System.out.println( str );	
		java.security.MessageDigest md = java.security.MessageDigest.getInstance("MD5");
		
		byte[] result = md.digest(str.getBytes());
		 StringBuffer buffer = new StringBuffer();
         // 把每一个byte 做一个与运算 0xff;
         for (byte b : result) {
             // 与运算
             int number = b & 0xff;// 加盐
             String str2 = Integer.toHexString(number);
             if (str2.length() == 1) {
                 buffer.append("0");
             }
             buffer.append(str2);
         }
		
		// digest()最后确定返回md5 hash值，返回值为8为字符串。因为md5 hash值是16位的hex值，实际上就是8位的字符
		// BigInteger函数则将8位的字符串转换成16位hex值，用字符串来表示；得到字符串形式的hash值
System.out.println( buffer.toString() );	
		 
		
String a = "aer\r\nb.bb\nccc hhh";
	
	 String[] arry = StringUtils.split( a );
	 for( int i = 0 ; i < arry.length ; i++ ) {
      System.out.println( arry[i] ) ;  
	 }
	 
	 System.out.println( ArrayUtils.contains( arry , "ccce") );
	 
	}
	
}
